Page({
  data: {
    
    selects: [],
    selectAlbums: [],
    albums: []
  },
  pictit: function () {
    wx.navigateTo({
      url: '../pictit/pictit',
    })
  },
  onShow: function () {
    var that = this;
    that.data.selectAlbums = [];
  },
  pictit: function () {
    var that = this;
    for (var i = 0; i < that.data.album.length; i++) {
      if (that.data.album[i].selects == 'bg_green') {
        that.data.selectAlbums.push(that.data.album[i].url);
      }
    }
    console.log(that.data.selectAlbums);
    getApp().globalData.selectAlbums = that.data.selectAlbums;
    if (getApp().globalData.people_type1 == '女生') {
      wx.navigateTo({
        url: '../pictit/pictit',
      })
    } else {
      wx.navigateTo({
        url: '../pictit/pictit',
      })
    }

  },
  pictit1: function () {
    wx.navigateTo({
      url: '../pictit/pictit',
    })
  },
  choose: function (e) {
    var that = this;
    console.log(e);
    
    var index = e.currentTarget.dataset.id;
    if (that.data.album[index].selects == 'bg_black') {
      that.setData({ ['album[' + index + '].selects']: 'bg_green', });
    } else {
      that.setData({ ['album[' + index + '].selects']: 'bg_black', });
    }
  },
  noChoose: function (e) {
    console.log("66666")
    var that = this;
    for (var i = 0; i < that.data.album.length; i++) {
      that.setData({ ['album[' + i + '].selects']: 'bg_black', });
    }
  },
  onLoad: function (options) {
    var album = getApp().globalData.changePics;
    var img_url1 = [];

    for (var i = 0; i < album.length; i++) {
      var obj = {};
      var img_url = album[i].split("=====");
      //var img_url = img_url[0];
      obj.url = img_url[0];
      obj.title = img_url[2];
      obj.selects = 'bg_black';
      img_url1.push(obj);


    }
    this.setData({ album: img_url1 });
    console.log("这是回调回来的图片");
    console.log(this.data.album);
    getApp().globalData.selectAlbums = '';
  }
})